<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateBatchWithdrawsTable extends Migration
{
    public function up()
    {
        Schema::create('batch_withdraws', function (Blueprint $table) {
	        $table->id();
	        $table->string('batch_number')->nullable()->index();
	        $table->string('ali_batch_id')->nullable()->index();
	        $table->integer('batch_count')->default(0);
	        $table->decimal('batch_amount', 10, 2)->default(0);
	        $table->string('payer')->nullable()->comment('alipay');
	        $table->string('payer_id')->nullable()->comment('alipay pid');
	        $table->integer('success_count')->default(0);
	        $table->decimal('success_amount', 10, 2)->default(0);
	        $table->integer('failed_count')->default(0);
	        $table->decimal('failed_amount', 10, 2)->default(0);
	        $table->string('status')->default('pending')->comment('pending, retry, failed, success');
	        $table->text('remark')->nullable();
	        $table->timestamps();
        });
    }
    
    public function down()
    {
        Schema::dropIfExists('batch_withdraws');
    }
}
